[pull] master from websockets:master#141
Open
pull[bot] wants to merge 317 commits into
Open
Conversation
13c5925 to
3d5066a
Compare
f77215b to
114de9e
Compare
431cc3e to
aca94c8
Compare
Make the `WebSocket` constructor throw a `SyntaxError` if the URL contains a fragment identifier or if the URL's protocol is not one of `'ws:'`, `'wss:'`, or `'ws+unix:'`.
When `WebSocketServer.prototype.close()` is called, stop accepting new connections but do not close the existing ones. If the HTTP/S server was created internally, then close it and emit the `'close'` event when it closes. Otherwise, if client tracking is enabled, then emit the `'close'` event when the number of connections goes down to zero. Otherwise, emit it in the next tick. Refs: #1902
Match the behavior of Node.js core `net.Server` and call the callback of `WebSocketServer.prototype.close()` with an error if the server is already closed.
106cf84 to
c4394c3
Compare
Make `WebSocket.prototype.addEventListener()` a noop if the `type` argument is not one of `'close'`, `'error'`, `'message'`, or `'open'`.
Make `WebSocket.prototype.removeEventListener()` only remove listeners added with `WebSocket.prototype.addEventListener()` and only one at time.
Prevent the `onclose`, `onerror`, `onmessage`, and `onopen` getters and setters from returning or removing event listeners added with `WebSocket.prototype.addEventListener()`. Also prevent `WebSocket.prototype.removeEventListener()` from removing event listeners added with the `onclose`, `onerror`, `onmessage`, and `onopen` setters. Refs: #1818
Make the `onclose`, `onerror`, `onmessage`, and `onopen` getters return `null` instead of `undefined` if the event handler is not set.
- Remove non-standard `OpenEvent` class. - Make properties read-only. - Update constructor signatures to match the ones defined by the HTML standard.
Do not rely on undocumented behavior, call `socket.read()` with the actual number of bytes to read. Refs: nodejs/node#60441
Make graceful close timeout configurable.
To simplify the API before exporting the `PerMessageDeflate` class, reduce the number of positional parameters in the constructor by moving `isServer` and `maxPayload` into the options object.
Export the `PerMessageDeflate` class, the parser and serializer for the `Sec-WebSocket-Extensions` header, and the parser for the `Sec-WebSocket-Protocol` header. Documentation is intentionally omitted as these utilities are primarily intended for niche use cases rather than general consumption. Refs: #2313
When the `reason` argument for `websocket.close()` is a `TypedArray` instead of a string or `Buffer`, the function does not correctly overwrite the dirty buffer allocated via `Buffer.allocUnsafe()`. This results in the disclosure of uninitialized memory, potentially leaking sensitive data to the remote peer. Add stricter validation for the argument type.
Previously, the receiver could retain one `Buffer` entry per buffered chunk or message fragment until enough data was parsed or the message completed. A peer could use many tiny fragments/chunks and make retained memory scale with retained part count rather than message payload size. Add configurable `maxBufferedChunks` and `maxFragments` options to bound the number of retained parts. When either limit is exceeded, emit a `WS_ERR_TOO_MANY_BUFFERED_PARTS` error and close the connection with close code 1008. Signed-off-by: Nadav0077 <18245584+Nadav0077@users.noreply.github.com>
Clarifiy that the values of the `maxBufferedChunks`, `maxFragments`, and `maxPayload` options are coerced to 32-bit signed integers.
Ensure that empty fragments are counted against the `maxFragments` limit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )